/**
 * @name 转成后台需要的数据
 * @param {*} list 带值的rule表单列表
 * @param {*} fieldList 需要特定的field时候
 * @returns
 */
export const formToData = (list, fieldList = []) => {
  let createData = Object.assign(
    [],
    fieldList?.length ? list.filter(i => fieldList.includes(i.field)) : list
  );
  createData.forEach(e => {
    //传数组的可以用isList判断
    if (e.type == "FormListImageFile" || e.type == "FormFileList" || e.isList) {
      e.val = e.value;
    } else {
      e.val = [e.value];
    }
    e.keyId = e.field;
  });
  return createData;
};
